<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
        <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
        <title>工单回单</title>
        <link rel="stylesheet" type="text/css" href="../../css/aui-win.css" />
        <link rel="stylesheet" type="text/css" href="../../css/common.css" />
        <link rel="stylesheet" href="../../script/ccssoft/css/ccssoft-lite.css" />
    </head>
    <body>
        <header class="aui-bar aui-bar-nav ccssoft-aui-bar-theme" id="header">
            <a class="aui-btn ccssoft-aui-bar-theme aui-pull-left" id="back" onclick="api.closeWin();"> <span class="aui-iconfont aui-icon-left"></span> </a>
            <div id='title' class="aui-title">
                工单回单
            </div>
        </header>
        <script src="../../script/jquery-1.11.3.min.js"></script>
        <script type="text/javascript" src="../../script/api.js"></script>
        <script type="text/javascript" src="../../script/common.js"></script>
        <script type="text/javascript" src="../../script/debug.js"></script>
        <script type="text/javascript">
            var billModel;
            apiready = function() {
                billModel = $api.getStorage('billModel');
                var header = $api.byId('header');
                $api.fixIos7Bar(header);
                var headerPos = $api.offset(header);
                var body_h = $api.offset($api.dom('body')).h;
                var frameName = '';
                console.log("billModel.faulttype:"+billModel.faulttype);
                console.log("billModel.istemperature:"+billModel.istemperature);
                console.log("billModel.businesstype:"+billModel.businesstype);
                console.log("api.pageParam.billStatus:"+api.pageParam.billStatus);
                console.log("billModel.rev_is_empty_run:"+billModel.rev_is_empty_run);
                //如果是运营商工单
                if ((billModel.faulttype == "GENERELEC" && billModel.istemperature == "Y")
                ||(billModel.faulttype =="2005"&&(billModel.businesstype.indexOf('运营商工单')!=-1||billModel.businesstype.indexOf('千寻公司工单')!=-1))
                || (billModel.faulttype =="2005"&&(billModel.rev_is_empty_run=='0'||billModel.rev_is_empty_run=='1'||billModel.rev_is_empty_run=='2'||'ELECTRIC_BEGIN'==api.pageParam.billStatus||'ELECTRIC_END'==api.pageParam.billStatus))) {
                	if('REVERT'==api.pageParam.billStatus){
                	   $api.byId('title').innerHTML='发电回单';
                	}else if('ELECTRIC_BEGIN'==api.pageParam.billStatus){
                	 $api.byId('title').innerHTML='开始发电';
                	}else if('ELECTRIC_END'==api.pageParam.billStatus){
                	 $api.byId('title').innerHTML='结束发电';
                	}
                	console.log("billModel.rev_is_empty_run:"+billModel.rev_is_empty_run);
                	console.log("11");
                	if('REVERT'==api.pageParam.billStatus&&(billModel.rev_is_empty_run==null||billModel.rev_is_empty_run=='')){
                    console.log("22");
                    //如果是运营商公单
                		if(billModel.faulttype =="2005"&&(billModel.businesstype.indexOf('运营商工单')!=-1||billModel.businesstype.indexOf('千寻公司工单')!=-1)
                		&&'REVERT'==api.pageParam.billStatus){
                			console.log("44");
                			frameName = 'billRevertYysElectric_frm';
                		}else{
                		console.log("55");
                   			 frameName = 'billRevertElectricDetail_frm';
                		}
                	}else{
                		//如果是运营商公单
                		if(billModel.faulttype =="2005"&&(billModel.businesstype.indexOf('运营商工单')!=-1||billModel.businesstype.indexOf('千寻公司工单')!=-1)
                		&&'REVERT'==api.pageParam.billStatus){
                			console.log("55");
                			frameName = 'billRevertYysElectric_frm';
                		}else{
                			console.log("33");
                	 		frameName = 'billRevertElectricNew_frm';
                		}

                	}
                } else {
                console.log("44");
                    frameName = 'billRevertCommonDetail_frm';
                }

                api.openFrame({
                    name : frameName,
                    url : frameName + '.html',
                    bounces : false,
                    pageParam : api.pageParam,
                    bgColor : '#f2f2f2',
                    rect : {
                        x : 0,
                        y : headerPos.h,
                        w : headerPos.w,
                        h : 'auto'
                    }
                });
            };
        </script>
    </body>
</html>
